package com.chapter.sample.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Repository
public interface AccountMapper {

    // +钱
    @Update("update tb_account set money = money+#{money} where account_name='${accountName}'")
    void incrMoney(@Param("accountName") String accountName, @Param("money") Integer money);

    // - 钱
    @Update("update tb_account set money = money-#{money} where account_name='${accountName}'")
    void decrMoney(@Param("accountName") String accountName, @Param("money") Integer money);
}
